package com.ss.project.xia17user.config.sys;

import cn.hutool.json.JSONUtil;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 配置值
 * @author xia17
 * @date 2020/9/21 17:41
 */
@Getter
@RequiredArgsConstructor
public class ConfigValue {

    private final String value;

    /**
     * 布尔值
     * @return /
     */
    public boolean forBoolean(){
        return "1".equals(value);
    }

    /**
     * 字符串值
     * @return /
     */
    public String forString(){
        return this.value;
    }

    /**
     * 实体类
     * @param clz /
     * @param <T> /
     * @return /
     */
    public<T> T forEntity(Class<T> clz){
        return JSONUtil.toBean(this.value,clz);
    }


}
